﻿namespace OboutInc.ImageZoom
{
    using Obout.Interface;
    using OboutInc.ImageZoom.Enums;
    using System;
    using System.Collections;
    using System.Collections.Generic;
    using System.Collections.Specialized;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Drawing.Design;
    using System.IO;
    using System.IO.Compression;
    using System.Runtime.CompilerServices;
    using System.Runtime.Serialization.Formatters.Binary;
    using System.Text;
    using System.Threading;
    using System.Web;
    using System.Web.UI;
    using System.Web.UI.Design;
    using System.Web.UI.HtmlControls;
    using System.Web.UI.WebControls;

    [ToolboxData("<{0}:ImageZoom runat=\"server\"> </{0}:ImageZoom>"), ToolboxBitmap(typeof(OboutInc.ImageZoom.ImageZoom), "imagezoom.bmp"), Designer(typeof(ImageZoomDesigner))]
    public sealed class ImageZoom : DataBoundControl, INamingContainer, ICallbackEventHandler, IPostBackDataHandler
    {
        private bool _allowPaging;
        private string _bigImageUrl = "";
        private AdapterBuilder _builder;
        private LayoutContainer _container;
        private List<string> _dataSource = new List<string>();
        private LinkButton _first;
        private OboutDropDownList _imageSizeSelector;
        private object _imageStream;
        private string _imageUrl = string.Empty;
        private readonly List<string> _imageZoomEntry = new List<string>();
        private bool _isImageSizeSelectorVisible = true;
        private bool _isPageSizeSelectorVisible = true;
        internal OboutInc.ImageZoom.ScriptManagerHelper _izScriptManager;
        private LinkButton _last;
        private ITemplate _layout;
        private bool _multiMode;
        private LinkButton _next;
        private Panel _pageDataPanel;
        private List<string> _pagedDataSource = new List<string>();
        private readonly Label _pageNum;
        private Panel _pageNumPanel;
        private OboutDropDownList _pageSizeSelector;
        private LinkButton _previous;
        private int _results = 10;
        private string _style;
        private string _viewState;
        internal static string GridPageIndex = "0";

        public event EventHandler DataUpdate;

        public event PageDelegate PageChanged;

        public ImageZoom()
        {
            this.NumberOfPagesShown = 5;
            this.DataDescriptionList = new List<string>();
            this.DataDescriptionField = string.Empty;
            this.DataUrlField = string.Empty;
            this.OnBeforeCloseButtonClick = "";
            this.OnCloseButtonClick = "";
            this.OnBeforeBackgroundClick = "";
            this.OnBackgroundClick = "";
            this.OnBeforeBigImageClick = "";
            this.OnBigImageClick = "";
            this.OnBeforeImageClick = "";
            this.OnImageClick = "";
            this.OnZoomOut = "";
            this.OnZoomIn = "";
            this.OnBeforeZoomOut = "";
            this.OnBeforeZoomIn = "";
            this.Position = ImageZoomPositions.SCREEN_CENTER;
            this.NumberOfFrames = 15;
            this.ZoomTime = 200;
            this.BackgroundOpacity = 0x19;
            this.zIndex = 0x3e8;
            this.Effect = ImageZoomEffects.Zooming;
            this.ShowLoading = true;
            this.ThumbnailFixedSize = false;
            this.Description = "";
            this.ThumbnailWidth = 100;
            this.ThumbnailHeight = 100;
            this.RelativeTop = 0;
            this.RelativeLeft = 0;
            AdapterCollection adapters = new AdapterCollection();
            adapters.Add(typeof(List<string>), new ListAdapterBuilder());
            this.Adapters = adapters;
            this._pageNum = new Label();
        }

        protected override void AddAttributesToRender(HtmlTextWriter writer)
        {
            if (!base.DesignMode && this.MultiMode)
            {
                base.Style[HtmlTextWriterStyle.Visibility] = "hidden";
            }
            this.Width = this.Width;
            base.AddAttributesToRender(writer);
        }

        private void ApplyDataSensitivityRules()
        {
            if (((this.AllowPaging && this.ShowFooter) && this.MultiMode) && (this.FirstButton != null))
            {
                this.FirstButton.Visible = this.IsPreviousVisible;
                this.PreviousButton.Visible = this.IsPreviousVisible;
                this.LastButton.Visible = this.IsNextVisible;
                this.NextButton.Visible = this.IsNextVisible;
                this.SetPagingImages();
                this.GeneratePagers();
                if (this.AllowPageSizeSelection)
                {
                    this.PageNumberLabel.Text = string.Format(" {0} to {1} of {2}", this.StartRow, (((this.StartRow + this.PageSize) - 1) > this.TotalPage) ? this.TotalPage : ((this.StartRow + this.PageSize) - 1), this.TotalPage);
                }
                else
                {
                    if (this._pageSizeSelector != null)
                    {
                        this._pageSizeSelector.Parent.Visible = false;
                    }
                    if (this.PageNumberLabel != null)
                    {
                        this.PageNumberLabel.Text = string.Format("Images per page:{0} - {1} to {2} of {3}", new object[] { this.PageSize, this.StartRow, (((this.StartRow + this.PageSize) - 1) > this.TotalPage) ? this.TotalPage : ((this.StartRow + this.PageSize) - 1), this.TotalPage });
                    }
                }
            }
        }

        private void BindParent()
        {
            if (this._builder == null)
            {
                this.GetBuilder();
            }
            if (this._builder != null)
            {
                this._pagedDataSource = this._builder.Adapter.GetPagedData(this.StartRow, this.PageSize * this.CurrentPageIndex) as List<string>;
            }
        }

        private void BoundControl_DataBound(object sender, EventArgs e)
        {
            ListAdapterBuilder builder = new ListAdapterBuilder {
                Source = this.InternalDataSource
            };
            this._builder = builder;
            this.ApplyDataSensitivityRules();
            this.BindParent();
            this.RaiseEvent(this.DataUpdate, this);
        }

        private bool CheckAjaxPageInheritance()
        {
            Type baseType = this.Page.GetType().BaseType;
            while (baseType != null)
            {
                if (baseType.ToString() == "OboutInc.oboutAJAXPage")
                {
                    return true;
                }
                try
                {
                    baseType = Activator.CreateInstance(baseType).GetType().BaseType;
                    continue;
                }
                catch (Exception exception1)
                {
                    if (exception1 != null)
                    {
                    }
                    return false;
                }
            }
            return false;
        }

        private static byte[] CompressDataSet(DataSet ds)
        {
            byte[] buffer = null;
            if (ds != null)
            {
                ds.RemotingFormat = SerializationFormat.Binary;
                BinaryFormatter formatter = new BinaryFormatter();
                MemoryStream serializationStream = new MemoryStream();
                formatter.Serialize(serializationStream, ds);
                byte[] buffer2 = serializationStream.ToArray();
                MemoryStream stream = new MemoryStream();
                DeflateStream stream3 = new DeflateStream(stream, CompressionMode.Compress);
                stream3.Write(buffer2, 0, buffer2.Length);
                stream3.Flush();
                stream3.Close();
                buffer = stream.ToArray();
                stream3.Dispose();
            }
            return buffer;
        }

        private DataSet ConvertDataViewToDataSet(DataView dv)
        {
            DataTable table;
            DataSet set = new DataSet();
            if ((dv != null) && (dv.Table != null))
            {
                table = dv.Table.Clone();
                foreach (DataRowView view in dv)
                {
                    table.ImportRow(view.Row);
                }
            }
            else
            {
                table = new DataTable();
            }
            set.Tables.Add(table);
            return set;
        }

        protected override void CreateChildControls()
        {
            if ((!string.IsNullOrEmpty(this.ImageUrl) || (this.ImageStream != null)) || !string.IsNullOrEmpty(this.DataUrlField))
            {
                this.Controls.Clear();
                HiddenField child = new HiddenField {
                    Value = this.WatermarkText,
                    ID = "_izwmtxt"
                };
                this.Controls.Add(child);
                if (this.InternalDataSource.Count > 0)
                {
                    this.CreateControlHierarchy(false);
                    base.ChildControlsCreated = true;
                }
                else if (((this.ImageUrl.Length == 0) && (this.ImageStream == null)) && !string.IsNullOrEmpty(this.DataUrlField))
                {
                    base.ChildControlsCreated = false;
                    base.RequiresDataBinding = true;
                }
                else
                {
                    this.CreateControlHierarchy(false);
                }
            }
        }

        private void CreateControlHierarchy(bool useDataSource)
        {
            if (this.MultiMode)
            {
                this.InstantiateTemplate();
                if ((this.InternalDataSource.Count > 0) && this.AllowPaging)
                {
                    this.GeneratePagers();
                }
                if (this.AllowImageSizeSelection)
                {
                    this.GetImageSizeSelector();
                }
                else if (this._imageSizeSelector != null)
                {
                    this._imageSizeSelector.Parent.Visible = false;
                }
                if (this.AllowPageSizeSelection && this.AllowPaging)
                {
                    this.GetPageSizeSelector();
                }
                HtmlGenericControl child = new HtmlGenericControl("DIV") {
                    InnerHtml = "<div id='oizbgnextPrev' class='oizZoomModeBg' style='display:none'></div><div id='izScriptis' style='display:none'></div>"
                };
                child.Style.Add("display", "none");
                this.Controls.Add(child);
            }
            if (!base.DesignMode)
            {
                if (this.MultiMode)
                {
                    if (this.ShowHeader)
                    {
                        this.CreateHeaderRow();
                    }
                    HtmlGenericControl control3 = new HtmlGenericControl("div") {
                        ID = "_izGC"
                    };
                    control3.Attributes.Add("class", IzCssSettings.CssImageZoomEntryContainer);
                    control3.Controls.Add(this.GetGalleryControl());
                    this.Controls.Add(control3);
                    if (this.ShowFooter)
                    {
                        this.CreateFooter();
                    }
                    HtmlInputHidden hidden = new HtmlInputHidden {
                        Value = this.CurrentPageIndex.ToString(),
                        ID = "_pgIndex"
                    };
                    this.Controls.Add(hidden);
                    HtmlInputHidden hidden2 = new HtmlInputHidden {
                        Value = this.ThumbnailWidth + "X" + this.ThumbnailHeight,
                        ID = "_imgSz"
                    };
                    this.Controls.Add(hidden2);
                    HtmlInputHidden hidden3 = new HtmlInputHidden {
                        Value = this.PageSize.ToString(),
                        ID = "_pgSz"
                    };
                    this.Controls.Add(hidden3);
                    HtmlInputHidden hidden4 = new HtmlInputHidden {
                        Value = this.TotalPagesToShow.ToString(),
                        ID = "_totPg"
                    };
                    this.Controls.Add(hidden4);
                }
                else
                {
                    HtmlGenericControl control5 = new HtmlGenericControl("ul");
                    control5.Attributes.Add("class", "ImageZoomEntryRow");
                    HtmlGenericControl control6 = new HtmlGenericControl("li");
                    control6.Attributes.Add("class", "ImageZoomEntryCell");
                    ImageZoomEntry entry2 = new ImageZoomEntry(this) {
                        ID = "ImageZoom"
                    };
                    using (ImageZoomEntry entry = entry2)
                    {
                        this.SetImageZoomProperties(entry);
                        entry.Description = this.Description;
                        entry.AlternateText = "";
                        entry.BigImageUrl = !string.IsNullOrEmpty(this.BigImageUrl) ? this.BigImageUrl : this.ImageUrl;
                        entry.ImageUrl = this.ImageUrl;
                        entry.ImageStream = this.ImageStream;
                        control6.Controls.Add(entry);
                        control5.Controls.Add(control6);
                        this._imageZoomEntry.Add(this.ClientID + entry.ClientID);
                    }
                    this.Controls.Add(control5);
                }
            }
        }

        private void CreateFooter()
        {
            using (HtmlGenericControl control = new HtmlGenericControl("div"))
            {
                control.Attributes.Add("class", IzCssSettings.CssGalleryBottumHolder);
                HtmlGenericControl child = new HtmlGenericControl("div");
                child.Attributes.Add("class", IzCssSettings.CssGalleryBottumLeft);
                HtmlGenericControl element = new HtmlGenericControl("div");
                element.Attributes.Add("class", IzCssSettings.CssGalleryBottum);
                this.GetGalleryPagerControls(element);
                HtmlGenericControl control4 = new HtmlGenericControl("div");
                control4.Attributes.Add("class", IzCssSettings.CssGalleryBottumRight);
                control.Controls.Add(child);
                control.Controls.Add(element);
                control.Controls.Add(control4);
                this.Controls.Add(control);
            }
        }

        private void CreateHeaderRow()
        {
            using (HtmlGenericControl control = new HtmlGenericControl("div"))
            {
                HtmlGenericControl control2;
                HtmlGenericControl control3;
                control.Attributes.Add("class", IzCssSettings.CssGalleryTopHolder);
                using (HtmlGenericControl control4 = new HtmlGenericControl("div"))
                {
                    control4.Attributes.Add("class", IzCssSettings.CssGalleryTopLeft);
                    control2 = new HtmlGenericControl("div");
                    control2.Attributes.Add("class", IzCssSettings.CssGalleryTop);
                    control3 = new HtmlGenericControl("div");
                    control3.Attributes.Add("class", IzCssSettings.CssGalleryTopRight);
                    control.Controls.Add(control4);
                }
                control.Controls.Add(control2);
                control.Controls.Add(control3);
                this.Controls.Add(control);
            }
        }

        private DataSet DecompressDataSet(byte[] bytDs)
        {
            DataSet set = new DataSet();
            MemoryStream stream = new MemoryStream(bytDs);
            stream.Seek(0L, SeekOrigin.Begin);
            using (DeflateStream stream2 = new DeflateStream(stream, CompressionMode.Decompress, true))
            {
                byte[] buffer = this.ReadFullStream(stream2);
                stream2.Flush();
                stream2.Close();
                MemoryStream serializationStream = new MemoryStream(buffer);
                serializationStream.Seek(0L, SeekOrigin.Begin);
                set.RemotingFormat = SerializationFormat.Binary;
                BinaryFormatter formatter = new BinaryFormatter();
                return (DataSet) formatter.Deserialize(serializationStream, null);
            }
        }

        private IEnumerable DeserializeDataSource()
        {
            DataView defaultView = new DataView();
            string s = "";
            if (!this.CallbackMode)
            {
                s = this.ViewState["DataSource"].ToString();
            }
            else if (this.IsCallback && (this._viewState != null))
            {
                s = this._viewState;
            }
            if (s != string.Empty)
            {
                byte[] bytDs = Convert.FromBase64String(s);
                defaultView = this.DecompressDataSet(bytDs).Tables[0].DefaultView;
            }
            return defaultView;
        }

        private void First_Click(object sender, EventArgs e)
        {
            this.CurrentPageIndex = 1;
            RaiseEvent(this.PageChanged, this, new PageChangedEventArgs(this.CurrentPageIndex, PagedEventInvoker.First));
            this.Update();
        }

        private void GeneratePagers()
        {
            this.GeneratePagers(this._pageNumPanel);
        }

        private void GeneratePagers(Control control)
        {
            control.Controls.Clear();
            this._pageDataPanel.Controls.Clear();
            this._pageDataPanel.Controls.Add(this.PageNumberLabel);
            if (this.ShowPager)
            {
                for (int i = ((this.PagerSequence - 1) * this.NumberOfPagesShown) + 1; (i <= this.NumberOfPagersToGenerate) && (i <= this.TotalPagesToShow); i++)
                {
                    HtmlGenericControl child = new HtmlGenericControl("div");
                    if (i != this.CurrentPageIndex)
                    {
                        child.Attributes.Add("class", "ob_IZPBN");
                    }
                    else
                    {
                        child.Attributes.Add("class", "ob_IZPBS");
                    }
                    LinkButton button = new LinkButton {
                        Text = i.ToString(),
                        ID = i.ToString()
                    };
                    child.Controls.Add(button);
                    control.Controls.Add(child);
                    if (this.CallbackMode)
                    {
                        StringBuilder builder = new StringBuilder();
                        builder.Append("var iz" + button.ClientID);
                        string str = this.Page.ClientScript.GetCallbackEventReference(this, "arg", this.ClientID + ".IZOnPaged", "context", "OboutIZ_CallbackError", true);
                        button.Attributes.Add("href", string.Format("javascript:{0}.page(" + i.ToString() + ")", this.ClientID));
                        builder.Append(" = function(arg,context){ " + str + "};");
                        this._izScriptManager.RegisterStartupScript("_izP" + i.ToString(), builder.ToString(), true);
                    }
                    else
                    {
                        button.Click += new EventHandler(this.Pager_Click);
                    }
                }
            }
        }

        private void GetBuilder()
        {
            object internalDataSource = this.InternalDataSource;
            this._builder = this.Adapters[internalDataSource.GetType()];
            this._builder.Source = this.InternalDataSource;
        }

        public string GetCallbackResult()
        {
            this.ApplyDataSensitivityRules();
            StringBuilder sb = new StringBuilder();
            StringWriter writer = new StringWriter(sb);
            HtmlTextWriter writer2 = new HtmlTextWriter(writer);
            this.GetGalleryControl().RenderControl(writer2);
            StringBuilder builder2 = new StringBuilder();
            StringWriter writer3 = new StringWriter(builder2);
            HtmlTextWriter writer4 = new HtmlTextWriter(writer3);
            this.PagerContainer.RenderControl(writer4);
            return string.Concat(new object[] { this.ClientID, "||", sb.ToString(), "||", builder2.ToString(), "||", this.EntryScripts.ToString(), "||", this.RegisterScript(), "||", this.CurrentPageIndex, "||", this.TotalPagesToShow.ToString() });
        }

        public List<string> GetFiles()
        {
            List<string> list = new List<string>();
            string path = this.Context.Server.MapPath(this.ImageUrl);
            if (Directory.Exists(path))
            {
                foreach (string str2 in "*.jpg;*.png;*.gif;*.tif;*.bmp;*tiff".Split(new char[] { ';' }))
                {
                    foreach (FileInfo info in new DirectoryInfo(path).GetFiles(str2))
                    {
                        list.Add(info.Name);
                    }
                }
            }
            return list;
        }

        private Control GetGalleryControl()
        {
            int num = 0;
            this.BindParent();
            List<string> list = this._pagedDataSource;
            this._imageZoomEntry.Clear();
            HtmlGenericControl control = new HtmlGenericControl("ul");
            control.Attributes.Add("class", IzCssSettings.CssImageZoomEntryRow);
            for (int i = 0; i < this.PageSize; i++)
            {
                HtmlGenericControl child = new HtmlGenericControl("li");
                if (this.ThumbnailFixedSize)
                {
                    child.Style.Add("Width", this.ThumbnailWidth.ToString() + "px");
                    child.Style.Add("Height", this.ThumbnailHeight.ToString() + "px");
                }
                HttpBrowserCapabilities browser = this.Page.Request.Browser;
                if ((browser.Type == "IE7") || (browser.Type == "IE6"))
                {
                    child.Style.Add("Display", "inline");
                }
                else
                {
                    child.Style["display"] = "inline-block";
                }
                child.Style["list-style-type"] = "none";
                if (num >= list.Count)
                {
                    if (this.ThumbnailFixedSize)
                    {
                        child.Attributes.Add("class", IzCssSettings.CssImageZoomEntryCell);
                        System.Web.UI.WebControls.Image image = new System.Web.UI.WebControls.Image {
                            ImageUrl = this.Page.ClientScript.GetWebResourceUrl(typeof(OboutInc.ImageZoom.ImageZoom), "OboutInc.ImageZoom.Resources.images.empty.gif"),
                            Height = new Unit((double) this.ThumbnailHeight, UnitType.Pixel),
                            Width = new Unit((double) this.ThumbnailWidth, UnitType.Pixel)
                        };
                        child.Controls.Add(image);
                        child.Style["WebkitBoxShadow"] = "none !important";
                        child.Style["MozBoxShadow"] = "none !important";
                        child.Style["boxShadow"] = "none !important";
                        child.Style["visibility"] = "hidden !important";
                        control.Controls.Add(child);
                    }
                }
                else
                {
                    ImageZoomEntry entry;
                    child.Attributes.Add("class", IzCssSettings.CssImageZoomEntryCell);
                    if (list[num].StartsWith("~"))
                    {
                        list[num] = base.ResolveUrl(list[num]);
                    }
                    string imgUrl = (this.ImageUrl != string.Empty) ? string.Format("{0}/{1}", this.ImageUrl, list[num]) : list[num];
                    string description = ((this.DataDescriptionList.Count > 0) && (this.DataDescriptionList.Count > ((this.StartRow - 1) + num))) ? this.DataDescriptionList[(this.StartRow - 1) + num] : this.Description;
                    if (this.IsCallback)
                    {
                        entry = this.GetZoomEntry(string.Format("{0}ImageZoomEntry{1}{2}", this.ClientID + "_", this.CurrentPageIndex, i), imgUrl, description);
                    }
                    else
                    {
                        entry = this.GetZoomEntry(string.Format("ImageZoomEntry{0}{1}", this.CurrentPageIndex, i), imgUrl, description);
                    }
                    if (this.ThumbnailFixedSize)
                    {
                        entry.Height = new Unit((double) this.ThumbnailHeight, UnitType.Pixel);
                        entry.Width = new Unit((double) this.ThumbnailWidth, UnitType.Pixel);
                    }
                    child.Controls.Add(entry);
                    if (this.CallbackMode)
                    {
                        if (this.EntryScripts == null)
                        {
                            this.EntryScripts = new StringBuilder();
                        }
                        this.EntryScripts.Append(entry.StartupScript());
                    }
                    control.Controls.Add(child);
                    if (this.IsCallback)
                    {
                        this._imageZoomEntry.Add(entry.ClientID);
                    }
                    else
                    {
                        this._imageZoomEntry.Add(this.ClientID + "_" + entry.ClientID);
                    }
                    num++;
                }
            }
            return control;
        }

        private void GetGalleryPagerControls(Control element)
        {
            if (this._container == null)
            {
                this.InstantiateTemplate();
            }
            HtmlGenericControl child = new HtmlGenericControl("ul");
            child.Attributes.Add("class", "ImageZoomPagerRow");
            HtmlGenericControl control2 = new HtmlGenericControl("li");
            control2.Attributes.Add("class", "ImageZoomPagerCell");
            control2.Controls.Add(this._container);
            child.Controls.Add(control2);
            element.Controls.Add(child);
        }

        private void GetImageSizeSelector()
        {
            this.ImageSizeSelector.Items.Clear();
            OboutDropDownList imageSizeSelector = this.ImageSizeSelector;
            string[] strArray = this.ImageSizeOptions.Split(new char[] { ',' });
            string str = "," + this.ImageSizeOptions + ",";
            bool flag = true;
            string str2 = this.ThumbnailWidth.ToString() + "X" + this.ThumbnailHeight.ToString();
            if (str.IndexOf("," + str2 + ",") == -1)
            {
                flag = false;
            }
            str = "";
            foreach (string str3 in strArray)
            {
                ListItem item = new ListItem();
                if (!flag)
                {
                    item.Value = str2.ToString();
                    item.Text = str2.ToString();
                    str = str + str2 + ",";
                    flag = true;
                }
                str = str + str3 + ",";
                item.Value = str3;
                item.Text = str3;
                imageSizeSelector.Items.Add(item);
            }
            this.ImageSizeOptions = str.TrimEnd(new char[] { ',' });
            imageSizeSelector.SelectedValue = str2.ToString();
        }

        public string GetImageZoomEntryByIndex(int index)
        {
            if (index < this._imageZoomEntry.Count)
            {
                return this._imageZoomEntry[index];
            }
            return null;
        }

        private void GetPageSizeSelector()
        {
            this.PageSizeSelector.Items.Clear();
            OboutDropDownList pageSizeSelector = this.PageSizeSelector;
            string[] strArray = this.PageSizeOptions.Split(new char[] { ',' });
            string str = "," + this.PageSizeOptions + ",";
            bool flag = true;
            int pageSize = this.PageSize;
            if (str.IndexOf("," + pageSize + ",") == -1)
            {
                flag = false;
            }
            str = "";
            foreach (string str2 in strArray)
            {
                ListItem item;
                if (!flag && (Convert.ToInt32(str2) > pageSize))
                {
                    item = new ListItem {
                        Value = pageSize.ToString(),
                        Text = pageSize.ToString()
                    };
                    str = str + pageSize + ",";
                    flag = true;
                    pageSizeSelector.Items.Add(item);
                }
                item = new ListItem {
                    Value = str2,
                    Text = str2
                };
                str = str + str2 + ",";
                pageSizeSelector.Items.Add(item);
            }
            this.PageSizeOptions = str.TrimEnd(new char[] { ',' });
            pageSizeSelector.SelectedValue = pageSize.ToString();
        }

        private string GetRegisterCss()
        {
            string[] strArray = null;
            if (this.StyleFolder != string.Empty)
            {
                strArray = this.StyleFolder.Split(new char[] { '/' });
                this._style = strArray[strArray.Length - 1];
            }
            else
            {
                this._style = "simple";
            }
            if (this.StyleFolder == string.Empty)
            {
                return this.Page.ClientScript.GetWebResourceUrl(base.GetType(), "OboutInc.ImageZoom.Resources.style.simple.min.css").Replace(".css", "");
            }
            return (this.StyleFolder + "/" + this._style);
        }

        private ImageZoomEntry GetZoomEntry(string id, string imgUrl, string description)
        {
            ImageZoomEntry entry2 = new ImageZoomEntry(this) {
                ID = id
            };
            using (ImageZoomEntry entry = entry2)
            {
                this.SetImageZoomProperties(entry);
                entry.ImageUrl = imgUrl;
                entry.AlternateText = "";
                entry.Description = description;
                entry.BigImageUrl = imgUrl;
                return entry;
            }
        }

        private void ImageSizeSelectorSelectedIndexChanged(object sender, EventArgs e)
        {
            string[] strArray = ((OboutDropDownList) sender).SelectedValue.Split(new char[] { Convert.ToChar("X") });
            this.ThumbnailWidth = Convert.ToInt32(strArray[0]);
            this.ThumbnailHeight = Convert.ToInt32(strArray[1]);
            this.Update();
        }

        private void InstantiateTemplate()
        {
            if (this.MultiMode)
            {
                this._container = new LayoutContainer();
                this.Layout.InstantiateIn(this._container);
                this._imageSizeSelector = (OboutDropDownList) this._container.FindControl(string.Format("{0}_ImageSizeSelector", this.ID));
                this._pageSizeSelector = (OboutDropDownList) this._container.FindControl(string.Format("{0}_PageSizeSelector", this.ID));
                if (this.SizeSelectorStyle != string.Empty)
                {
                    if (this._pageSizeSelector != null)
                    {
                        this._pageSizeSelector.FolderStyle = this.SizeSelectorStyle;
                    }
                    if (this._imageSizeSelector != null)
                    {
                        this._imageSizeSelector.FolderStyle = this.SizeSelectorStyle;
                    }
                }
                if (this.AllowPaging)
                {
                    this.PagerContainer = (Panel) this._container.FindControl("pageCBCP");
                    this._pageDataPanel = (Panel) this._container.FindControl("PageData");
                    this._first = (LinkButton) this._container.FindControl("First");
                    this._previous = (LinkButton) this._container.FindControl("Previous");
                    this._next = (LinkButton) this._container.FindControl("Next");
                    this._last = (LinkButton) this._container.FindControl("Last");
                    this._pageNumPanel = (Panel) this._container.FindControl("Pager");
                    if (!this.CallbackMode)
                    {
                        this._first.Click += new EventHandler(this.First_Click);
                        this._last.Click += new EventHandler(this.Last_Click);
                        this._next.Click += new EventHandler(this.Next_Click);
                        this._previous.Click += new EventHandler(this.Previous_Click);
                        if (this.AllowPageSizeSelection && (this._pageSizeSelector != null))
                        {
                            this._pageSizeSelector.SelectedIndexChanged += new EventHandler(this.PageSizeSelectorSelectedIndexChanged);
                        }
                        if (this.AllowImageSizeSelection && (this._imageSizeSelector != null))
                        {
                            this._imageSizeSelector.SelectedIndexChanged += new EventHandler(this.ImageSizeSelectorSelectedIndexChanged);
                        }
                    }
                    else
                    {
                        StringBuilder builder = new StringBuilder();
                        builder.Append("var ").Append(this.ClientID).Append("_izOnNPPage");
                        builder.Append(" = function(arg,context){ " + this.Page.ClientScript.GetCallbackEventReference(this, "arg", this.ClientID + ".IZOnPaged", "context", "OboutIZ_CallbackError", true) + "};");
                        this._izScriptManager.RegisterStartupScript(this.ClientID + ".izOnNPPage", builder.ToString(), true);
                        this._first.Attributes.Add("href", string.Format("javascript:{0}.FirstPage()", this.ClientID));
                        this._last.Attributes.Add("href", string.Format("javascript:{0}.LastPage()", this.ClientID));
                        this._next.Attributes.Add("href", string.Format("javascript:{0}.NextPage()", this.ClientID));
                        this._previous.Attributes.Add("href", string.Format("javascript:{0}.PrevPage()", this.ClientID));
                        if (this.AllowPageSizeSelection && (this._pageSizeSelector != null))
                        {
                            StringBuilder builder2 = new StringBuilder();
                            builder2.Append("function(s,e){").Append(this.ClientID).Append(".onPSC(s.options[e].text)}");
                            this._pageSizeSelector.ClientSideEvents.OnSelectedIndexChanged = string.Format("{0}.pageSizeChanged={1}", this.ClientID, builder2.ToString());
                            this._pageSizeSelector.AutoPostBack = false;
                        }
                        if (this.AllowImageSizeSelection && (this._imageSizeSelector != null))
                        {
                            StringBuilder builder3 = new StringBuilder();
                            builder3.Append("function(s,e){").Append(this.ClientID).Append(".onImgSC(s.options[e].text)}");
                            this._imageSizeSelector.AutoPostBack = false;
                            this._imageSizeSelector.ClientSideEvents.OnSelectedIndexChanged = string.Format("{0}.imageSizeChanged={1}", this.ClientID, builder3.ToString());
                        }
                    }
                }
            }
        }

        private void Last_Click(object sender, EventArgs e)
        {
            this.CurrentPageIndex = this.TotalPagesToShow;
            RaiseEvent(this.PageChanged, this, new PageChangedEventArgs(this.CurrentPageIndex, PagedEventInvoker.Last));
            this.Update();
        }

        protected override void LoadControlState(object savedState)
        {
            base.LoadControlState(savedState);
        }

        public bool LoadPostData(string postDataKey, NameValueCollection postCollection)
        {
            throw new NotImplementedException();
        }

        protected override void LoadViewState(object savedState)
        {
            base.LoadViewState(savedState);
        }

        private void Next_Click(object sender, EventArgs e)
        {
            if (this.CurrentPageIndex < this.TotalPagesToShow)
            {
                this.CurrentPageIndex++;
            }
            RaiseEvent(this.PageChanged, this, new PageChangedEventArgs(this.CurrentPageIndex, PagedEventInvoker.Next));
            this.Update();
        }

        protected override void OnInit(EventArgs e)
        {
            Literal literal;
            HtmlHead header = this.Page.Header;
            literal = literal = new Literal();
            bool flag = false;
            literal = new Literal {
                ID = "izScript",
                Text = string.Format("<script src=\"{0}\" type=\"text/javascript\" ></script>", this.Page.ClientScript.GetWebResourceUrl(typeof(OboutInc.ImageZoom.ImageZoom), "OboutInc.ImageZoom.Resources.javascript.imagezoom.min.js"))
            };
            if (this.CallbackMode)
            {
                literal.Text = literal.Text + string.Format("<script src=\"{0}\" type=\"text/javascript\" ></script>", this.Page.ClientScript.GetWebResourceUrl(typeof(OboutInc.ImageZoom.ImageZoom), "OboutInc.ImageZoom.Resources.javascript.IzCallBack.min.js"));
            }
            if ((header != null) && (header.FindControl("izScript") == null))
            {
                try
                {
                    header.Controls.Add(literal);
                    flag = true;
                }
                catch
                {
                }
            }
            this._izScriptManager = new OboutInc.ImageZoom.ScriptManagerHelper(this);
            if (!flag)
            {
                this._izScriptManager.RegisterClientScriptInclude("oboutIZIncl_0", this.Page.ClientScript.GetWebResourceUrl(typeof(OboutInc.ImageZoom.ImageZoom), "OboutInc.ImageZoom.Resources.javascript.imagezoom.min.js"));
                if (this.CallbackMode)
                {
                    this._izScriptManager.RegisterClientScriptInclude("oboutIZIncl_1", this.Page.ClientScript.GetWebResourceUrl(typeof(OboutInc.ImageZoom.ImageZoom), "OboutInc.ImageZoom.Resources.javascript.IzCallBack.min.js"));
                }
            }
            this.Page.RegisterRequiresControlState(this);
            if (this.InternalDataSource.Count > 0)
            {
                base.DataBinding += new EventHandler(this.BoundControl_DataBound);
            }
            base.OnInit(e);
        }

        protected override void OnPreRender(EventArgs e)
        {
            string[] strArray = null;
            if (this.StyleFolder != string.Empty)
            {
                strArray = this.StyleFolder.Split(new char[] { '/' });
                this._style = strArray[strArray.Length - 1];
            }
            else
            {
                this._style = "simple";
            }
            this.CssClass = this._style + "_oizg";
            if (this._izScriptManager.IsInAsyncPostBack)
            {
                this._izScriptManager.RegisterClientScriptBlock(this, "oboutIZCss_1_", "(function(){var head = document.getElementsByTagName('HEAD')[0];if (head) {var linkElement = document.createElement('link');linkElement.type = 'text/css';linkElement.rel = 'stylesheet';linkElement.href = '" + this.GetRegisterCss() + "';head.appendChild(linkElement);}})();", true);
            }
            else
            {
                this._izScriptManager.RegisterStartupScript("oboutIZCss_" + this.ClientID, this.RegisterCss(), false);
            }
            base.OnPreRender(e);
        }

        private void Pager_Click(object sender, EventArgs e)
        {
            LinkButton button = (LinkButton) sender;
            this.CurrentPageIndex = int.Parse(button.ID);
            RaiseEvent(this.PageChanged, this, new PageChangedEventArgs(this.CurrentPageIndex, PagedEventInvoker.Pager));
            this.Update();
        }

        private void PageSizeSelectorSelectedIndexChanged(object sender, EventArgs e)
        {
            this.CurrentPageIndex = 1;
            this.PageSize = Convert.ToInt32(((OboutDropDownList) sender).SelectedValue);
            this.Update();
        }

        protected override void PerformDataBinding(IEnumerable retrievedData)
        {
            base.PerformDataBinding(retrievedData);
            if (retrievedData != null)
            {
                List<string> list = new List<string>();
                List<string> list2 = new List<string>();
                string item = string.Empty;
                string str2 = string.Empty;
                int num = 0;
                try
                {
                    foreach (object obj2 in retrievedData)
                    {
                        num++;
                        if (this.DataUrlField.Length > 0)
                        {
                            item = DataBinder.GetPropertyValue(obj2, this.DataUrlField, null);
                        }
                        if (this.DataDescriptionField.Length > 0)
                        {
                            str2 = DataBinder.GetPropertyValue(obj2, this.DataDescriptionField, null);
                        }
                        if (!(item.Trim() == string.Empty))
                        {
                            list.Add(item);
                            list2.Add(str2);
                        }
                    }
                    this.InternalDataSource = list;
                    this.DataDescriptionList = list2;
                }
                catch (Exception exception)
                {
                    throw exception;
                }
                this.OnDataBinding(EventArgs.Empty);
                this.Controls.Clear();
                this.CreateControlHierarchy(true);
            }
            if (this.InternalDataSource.Count > 0)
            {
                base.ChildControlsCreated = true;
            }
        }

        private void Previous_Click(object sender, EventArgs e)
        {
            if (this.CurrentPageIndex > 1)
            {
                this.CurrentPageIndex--;
            }
            RaiseEvent(this.PageChanged, this, new PageChangedEventArgs(this.CurrentPageIndex, PagedEventInvoker.Previous));
            this.Update();
        }

        public void RaiseCallbackEvent(string eventArgument)
        {
            string[] strArray = eventArgument.Split(",".ToCharArray());
            this.IsCallback = true;
            this.EntryScripts = new StringBuilder();
            if (strArray[0] == "page")
            {
                this.CurrentPageIndex = int.Parse(strArray[1]);
                RaiseEvent(this.PageChanged, this, new PageChangedEventArgs(this.CurrentPageIndex, PagedEventInvoker.Pager));
                string[] strArray2 = strArray[2].Split(new char[] { Convert.ToChar("X") });
                this.ThumbnailWidth = Convert.ToInt32(strArray2[0]);
                this.ThumbnailHeight = Convert.ToInt32(strArray2[1]);
                this.PageSize = int.Parse(strArray[3]);
                this.Update();
            }
            if (strArray[0] == "NextPage")
            {
                this.CurrentPageIndex = int.Parse(strArray[1]);
                string s = strArray[4];
                if (this.CurrentPageIndex < int.Parse(s))
                {
                    this.CurrentPageIndex++;
                }
                RaiseEvent(this.PageChanged, this, new PageChangedEventArgs(this.CurrentPageIndex, PagedEventInvoker.Next));
                string[] strArray3 = strArray[2].Split(new char[] { Convert.ToChar("X") });
                this.ThumbnailWidth = Convert.ToInt32(strArray3[0]);
                this.ThumbnailHeight = Convert.ToInt32(strArray3[1]);
                this.PageSize = int.Parse(strArray[3]);
                this.Update();
            }
            if (strArray[0] == "LastPage")
            {
                this.CurrentPageIndex = int.Parse(strArray[3]);
                RaiseEvent(this.PageChanged, this, new PageChangedEventArgs(this.CurrentPageIndex, PagedEventInvoker.Last));
                string[] strArray4 = strArray[1].Split(new char[] { Convert.ToChar("X") });
                this.ThumbnailWidth = Convert.ToInt32(strArray4[0]);
                this.ThumbnailHeight = Convert.ToInt32(strArray4[1]);
                this.PageSize = int.Parse(strArray[2]);
                this.Update();
            }
            if (strArray[0] == "FirstPage")
            {
                this.CurrentPageIndex = 1;
                RaiseEvent(this.PageChanged, this, new PageChangedEventArgs(this.CurrentPageIndex, PagedEventInvoker.First));
                string[] strArray5 = strArray[1].Split(new char[] { Convert.ToChar("X") });
                this.ThumbnailWidth = Convert.ToInt32(strArray5[0]);
                this.ThumbnailHeight = Convert.ToInt32(strArray5[1]);
                this.PageSize = int.Parse(strArray[2]);
                this.Update();
            }
            if (strArray[0] == "PrevPage")
            {
                this.CurrentPageIndex = int.Parse(strArray[1]);
                if (this.CurrentPageIndex > 1)
                {
                    this.CurrentPageIndex--;
                }
                RaiseEvent(this.PageChanged, this, new PageChangedEventArgs(this.CurrentPageIndex, PagedEventInvoker.Previous));
                string[] strArray6 = strArray[2].Split(new char[] { Convert.ToChar("X") });
                this.ThumbnailWidth = Convert.ToInt32(strArray6[0]);
                this.ThumbnailHeight = Convert.ToInt32(strArray6[1]);
                this.PageSize = int.Parse(strArray[3]);
                this.Update();
            }
            if (strArray[0] == "PageSize")
            {
                this.CurrentPageIndex = 1;
                string[] strArray7 = strArray[2].Split(new char[] { Convert.ToChar("X") });
                this.ThumbnailWidth = Convert.ToInt32(strArray7[0]);
                this.ThumbnailHeight = Convert.ToInt32(strArray7[1]);
                this.PageSize = int.Parse(strArray[1]);
                this.Update();
            }
            if (strArray[0] == "ImageSize")
            {
                string[] strArray8 = strArray[1].Split(new char[] { Convert.ToChar("X") });
                this.ThumbnailWidth = Convert.ToInt32(strArray8[0]);
                this.ThumbnailHeight = Convert.ToInt32(strArray8[1]);
                this.PageSize = int.Parse(strArray[2]);
                this.Update();
            }
        }

        private void RaiseEvent(EventHandler e, object sender)
        {
            RaiseEvent(e, this, null);
        }

        private static void RaiseEvent(PageDelegate e, object sender, PageChangedEventArgs args)
        {
            if (e != null)
            {
                e(sender, args);
            }
        }

        private static void RaiseEvent(EventHandler e, object sender, PageChangedEventArgs args)
        {
            if (e != null)
            {
                e(sender, args);
            }
        }

        public void RaisePostDataChangedEvent()
        {
            throw new NotImplementedException();
        }

        private byte[] ReadFullStream(Stream stream)
        {
            byte[] buffer2;
            byte[] buffer = new byte[0x1000];
            using (MemoryStream stream2 = new MemoryStream())
            {
                int num;
            Label_0011:
                num = 0;
                num = stream.Read(buffer, 0, buffer.Length);
                if (num <= 0)
                {
                    buffer2 = stream2.ToArray();
                }
                else
                {
                    stream2.Write(buffer, 0, num);
                    goto Label_0011;
                }
            }
            return buffer2;
        }

        private string RegisterCallbackScript()
        {
            StringBuilder builder = new StringBuilder();
            builder.Append("var ").Append(this.ClientID).Append(" = new IzCallBack('").Append(this.ClientID).Append("');");
            return builder.ToString();
        }

        private string RegisterCss()
        {
            string[] strArray = null;
            if (this.StyleFolder != string.Empty)
            {
                strArray = this.StyleFolder.Split(new char[] { '/' });
                this._style = strArray[strArray.Length - 1];
            }
            else
            {
                this._style = "simple";
            }
            if (this.StyleFolder == string.Empty)
            {
                return string.Format("<link href=\"{0}\" rel=\"stylesheet\" type=\"text/css\" />", this.Page.ClientScript.GetWebResourceUrl(base.GetType(), "OboutInc.ImageZoom.Resources.style.simple.min.css").Replace(".css", ""));
            }
            return string.Format("<link href=\"{0}.css\" rel=\"stylesheet\" type=\"text/css\" />", this.StyleFolder + "/" + this._style);
        }

        private string RegisterScript()
        {
            string newValue = "";
            foreach (string str2 in this._imageZoomEntry.ToArray())
            {
                newValue = newValue + string.Format("'{0}',", str2);
            }
            newValue = newValue.TrimEnd(new char[] { Convert.ToChar(",") });
            string str3 = "";
            str3 = "[{objects}];";
            StringBuilder builder = new StringBuilder();
            string str4 = this.ClientID + "_ImageZoomEntries";
            if (GridPageIndex == "1")
            {
                builder.Append(" if(typeof(" + str4 + ")!='undefined'){if(typeof(" + str4 + ".destruct)=='function'){" + str4 + ".destruct();}}");
            }
            string str5 = str3.Replace("{objects}", newValue);
            builder.Append("var " + str4 + "=").Append(str5);
            return builder.ToString();
        }

        private string RegisterScriptLib()
        {
            string str = "<script type='text/javascript'>if(typeof _libImageZoom=='undefined'){document.write(unescape(\"%3Cscript type='text/javascript' src='{src}'%3E %3C/script%3E\"));_libImageZoom=1;}</script>";
            string webResourceUrl = this.Page.ClientScript.GetWebResourceUrl(base.GetType(), "OboutInc.ImageZoom.Resources.javascript.imagezoom.min.js");
            return str.Replace("{src}", webResourceUrl);
        }

        protected override void Render(HtmlTextWriter writer)
        {
            string[] strArray = null;
            if (this.StyleFolder != string.Empty)
            {
                strArray = this.StyleFolder.Split(new char[] { '/' });
                this._style = strArray[strArray.Length - 1];
            }
            else
            {
                this._style = "simple";
            }
            this.CssClass = this._style + "_oizg";
            bool flag = false;
            if (OboutInc.ImageZoom.ScriptManagerHelper.IsInsideGridWithCallback(this))
            {
                flag = true;
            }
            if (!base.ChildControlsCreated)
            {
                this.CreateControlHierarchy(false);
            }
            new OboutInc.ImageZoom.ScriptManagerHelper(this);
            if (flag)
            {
                HtmlGenericControl control = new HtmlGenericControl("div");
                control.Attributes.Add("class", "ob_iCallbackScript");
                control.Attributes.Add("style", "display:none");
                control.InnerHtml = this.RegisterScript();
                control.Dispose();
            }
            else if (!this.CheckAjaxPageInheritance())
            {
                this._izScriptManager.RegisterStartupScript("ob_iz_" + this.UniqueID, this.RegisterScript(), true);
                if (this.CallbackMode)
                {
                    this._izScriptManager.RegisterStartupScript("ob_iz_cb" + this.UniqueID, this.RegisterCallbackScript(), true);
                }
            }
            else
            {
                writer.Write("<script type=\"text/javascript\">" + this.RegisterScript() + "</script>");
            }
            this.ApplyDataSensitivityRules();
            base.Render(writer);
        }

        private string resolveServerSide(string imagePath)
        {
            string relativeUrl = imagePath;
            if ((((relativeUrl.IndexOf(".aspx", StringComparison.OrdinalIgnoreCase) <= 0) && (relativeUrl.IndexOf(".php", StringComparison.OrdinalIgnoreCase) <= 0)) && (relativeUrl.IndexOf(".ashx", StringComparison.OrdinalIgnoreCase) <= 0)) || (relativeUrl.StartsWith("http://") || relativeUrl.StartsWith("https://")))
            {
                return relativeUrl;
            }
            if (relativeUrl.IndexOf("~") == 0)
            {
                relativeUrl = base.ResolveUrl(relativeUrl);
            }
            HttpRequest request = HttpContext.Current.Request;
            bool flag = request.ServerVariables["HTTPS"] == "on";
            string str2 = request.ServerVariables["SERVER_PROTOCOL"].Split(new char[] { '/' })[0].ToLower() + (flag ? "s" : "");
            string str3 = ":" + request.ServerVariables["SERVER_PORT"];
            switch (str3)
            {
                case ":80":
                case ":443":
                    str3 = "";
                    break;
            }
            string str4 = str2 + "://" + request.ServerVariables["SERVER_NAME"] + str3;
            if (!relativeUrl.StartsWith("/"))
            {
                relativeUrl = "/" + relativeUrl;
            }
            return (str4 + relativeUrl);
        }

        protected override object SaveControlState()
        {
            return base.SaveControlState();
        }

        protected override object SaveViewState()
        {
            return base.SaveViewState();
        }

        private void SerializeDataSource(IEnumerable enumerableDataSource)
        {
            DataView dv = enumerableDataSource as DataView;
            byte[] inArray = CompressDataSet(this.ConvertDataViewToDataSet(dv));
            if (inArray != null)
            {
                if (!this.CallbackMode)
                {
                    this.ViewState["DataSource"] = Convert.ToBase64String(inArray);
                }
                else
                {
                    string str = Convert.ToBase64String(inArray);
                    this._viewState = str;
                }
            }
        }

        private void SetImageZoomProperties(ImageZoomEntry zoom)
        {
            zoom.StyleFolder = this.StyleFolder;
            zoom.Effect = this.Effect;
            zoom.Position = this.Position;
            zoom.BackgroundOpacity = this.BackgroundOpacity;
            zoom.ShowLoading = this.ShowLoading;
            zoom.ZoomTime = this.ZoomTime;
            zoom.NumberOfFrames = this.NumberOfFrames;
            zoom.RelativeLeft = this.RelativeLeft;
            zoom.RelativeTop = this.RelativeTop;
            zoom.zIndex = this.zIndex;
            zoom.ThumnailHeight = this.ThumbnailHeight;
            zoom.Thumnailwidth = this.ThumbnailWidth;
            zoom.OnBeforeZoomIn = this.OnBeforeZoomIn;
            zoom.OnBeforeZoomOut = this.OnBeforeZoomOut;
            zoom.OnZoomIn = this.OnZoomIn;
            zoom.OnZoomOut = this.OnZoomOut;
            zoom.OnImageClick = this.OnImageClick;
            zoom.OnBeforeImageClick = this.OnBeforeImageClick;
            zoom.OnBigImageClick = this.OnBigImageClick;
            zoom.OnBeforeBigImageClick = this.OnBeforeBigImageClick;
            zoom.OnBackgroundClick = this.OnBackgroundClick;
            zoom.OnBeforeBackgroundClick = this.OnBeforeBackgroundClick;
            zoom.OnCloseButtonClick = this.OnCloseButtonClick;
            zoom.OnBeforeCloseButtonClick = this.OnBeforeCloseButtonClick;
        }

        private void SetPagingImages()
        {
            this.NextButton.Controls.Clear();
            this.LastButton.Controls.Clear();
            this.FirstButton.Controls.Clear();
            this.PreviousButton.Controls.Clear();
            if (this.StyleFolder == string.Empty)
            {
                HtmlImage child = new HtmlImage {
                    Border = 0,
                    Src = this.Page.ClientScript.GetWebResourceUrl(typeof(OboutInc.ImageZoom.ImageZoom), "OboutInc.ImageZoom.Resources.style.next.png")
                };
                HtmlImage image2 = new HtmlImage {
                    Border = 0,
                    Src = this.Page.ClientScript.GetWebResourceUrl(typeof(OboutInc.ImageZoom.ImageZoom), "OboutInc.ImageZoom.Resources.style.last.png")
                };
                HtmlImage image3 = new HtmlImage {
                    Border = 0,
                    Src = this.Page.ClientScript.GetWebResourceUrl(typeof(OboutInc.ImageZoom.ImageZoom), "OboutInc.ImageZoom.Resources.style.prev.png")
                };
                HtmlImage image4 = new HtmlImage {
                    Border = 0,
                    Src = this.Page.ClientScript.GetWebResourceUrl(typeof(OboutInc.ImageZoom.ImageZoom), "OboutInc.ImageZoom.Resources.style.first.png")
                };
                this.NextButton.Controls.Add(child);
                this.LastButton.Controls.Add(image2);
                this.FirstButton.Controls.Add(image4);
                this.PreviousButton.Controls.Add(image3);
            }
        }

        public void Update()
        {
            if (this.HasParentControlCalledDataBinding)
            {
                this.BindParent();
                this.CreateChildControls();
                this.RaiseEvent(this.DataUpdate, this);
            }
        }

        private AdapterCollection Adapters { get; set; }

        [DefaultValue(true), Description("Show/Hide the Image Size selection drop-down"), Category("Settings")]
        public bool AllowImageSizeSelection
        {
            get
            {
                return this._isImageSizeSelectorVisible;
            }
            set
            {
                this._isImageSizeSelectorVisible = value;
            }
        }

        [DefaultValue(true), Category("Paging"), Description("Show/Hide the Page Size selection drop-down."), Bindable(true)]
        public bool AllowPageSizeSelection
        {
            get
            {
                return this._isPageSizeSelectorVisible;
            }
            set
            {
                this._isPageSizeSelectorVisible = value;
            }
        }

        [Category("Paging"), Bindable(true), Description("Show/Hide the buttons for changing the page."), DefaultValue(true)]
        public bool AllowPaging
        {
            get
            {
                if (this.ViewState["_EnablePaging"] == null)
                {
                    this._allowPaging = this.MultiMode;
                }
                else
                {
                    object obj2 = this.ViewState["_EnablePaging"];
                    this._allowPaging = (bool) obj2;
                }
                return this._allowPaging;
            }
            set
            {
                this.ViewState["_EnablePaging"] = value;
            }
        }

        [DefaultValue("25"), Description(" Gets or sets opacity of background"), Bindable(true), Category("Appearance")]
        public int BackgroundOpacity { get; set; }

        [Bindable(true), Category("Appearance"), DefaultValue(400), Description("BigImage height")]
        public int BigImageHeight
        {
            get
            {
                if (this.ViewState["BigImageHeight"] == null)
                {
                    return 400;
                }
                return Convert.ToInt32(this.ViewState["BigImageHeight"]);
            }
            set
            {
                this.ViewState["BigImageHeight"] = value;
            }
        }

        [Category("Appearance"), DefaultValue(0), Description("Sets BigImage size options")]
        public OboutInc.ImageZoom.Enums.BigImageSize BigImageSize { get; set; }

        [Description("Gets or sets the big image url in single mode"), Category("Appearance"), Editor(typeof(UrlEditor), typeof(UITypeEditor)), Bindable(true)]
        public string BigImageUrl
        {
            get
            {
                return this._bigImageUrl;
            }
            set
            {
                bool flag1 = value != string.Empty;
                string imagePath = value;
                imagePath = this.resolveServerSide(imagePath);
                if (imagePath.IndexOf("~") == 0)
                {
                    imagePath = base.ResolveUrl(imagePath);
                }
                this._bigImageUrl = imagePath;
                base.ChildControlsCreated = false;
            }
        }

        [Description("BigImage width"), Category("Appearance"), DefaultValue(400), Bindable(true)]
        public int BigImageWidth
        {
            get
            {
                if (this.ViewState["BigImageWidth"] == null)
                {
                    return 400;
                }
                return Convert.ToInt32(this.ViewState["BigImageWidth"]);
            }
            set
            {
                this.ViewState["BigImageWidth"] = value;
            }
        }

        [DefaultValue("Image containing folder"), Description("Sets a particular folder to save cached images."), Category("Settings")]
        public string CacheDirectory
        {
            get
            {
                object obj2 = this.ViewState["cachDirName"];
                if (obj2 != null)
                {
                    return obj2.ToString();
                }
                return string.Empty;
            }
            set
            {
                this.ViewState["cachDirName"] = value;
            }
        }

        [Description("Enables/disables the callback mode"), Category("Settings"), DefaultValue(false)]
        public bool CallbackMode
        {
            get
            {
                object obj2 = this.ViewState["CallbackMode"];
                return ((obj2 != null) && ((bool) obj2));
            }
            set
            {
                this.ViewState["CallbackMode"] = value;
            }
        }

        [Bindable(true), Description("Number of columns per page in table layout."), Category("Layout"), DefaultValue(4)]
        private int Columns
        {
            get
            {
                object obj2 = this.ViewState["PageColumns"];
                if ((obj2 == null) && !this.AllowPaging)
                {
                    int count = this.InternalDataSource.Count;
                    int num2 = 0;
                    int num3 = (this.ViewState["PageRows"] == null) ? 4 : this.Rows;
                    if (count > 0)
                    {
                        if (num3 == 0)
                        {
                            num3 = 1;
                        }
                        num2 = count / num3;
                    }
                    int num4 = count % num3;
                    if (num4 > 0)
                    {
                        num2++;
                    }
                    obj2 = num2;
                }
                if (obj2 != null)
                {
                    obj2 = (((int) obj2) == 0) ? 1 : obj2;
                }
                if (obj2 != null)
                {
                    return (int) obj2;
                }
                return 4;
            }
            set
            {
                this.ViewState["PageColumns"] = value;
            }
        }

        [Category("Paging"), DefaultValue(1), Bindable(true), Description("The one starting index of page that is displayed in the ImageZoom.")]
        public int CurrentPageIndex
        {
            get
            {
                int num = 1;
                object obj2 = this.ViewState["CurrentPage"];
                if (obj2 != null)
                {
                    num = Convert.ToInt32(obj2);
                }
                return num;
            }
            set
            {
                this.ViewState["CurrentPage"] = value;
            }
        }

        [Bindable(true), Description("Image category field in datasource."), Category("Data")]
        public string DataCategoryField { get; set; }

        [Category("Data"), Bindable(true), Description("Image description field in datasource.")]
        public string DataDescriptionField { get; set; }

        private List<string> DataDescriptionList
        {
            get
            {
                if (this.ViewState["DataDescriptionList"] == null)
                {
                    this.ViewState["DataDescriptionList"] = new List<string>();
                }
                return (this.ViewState["DataDescriptionList"] as List<string>);
            }
            set
            {
                this.ViewState["DataDescriptionList"] = value;
            }
        }

        [Browsable(false)]
        public override object DataSource
        {
            get
            {
                return base.DataSource;
            }
            set
            {
                base.DataSource = value;
            }
        }

        [Description("Image url field in datasource"), Bindable(true), Category("Data")]
        public string DataUrlField { get; set; }

        [Bindable(true), Category("Appearance"), Description(" Gets or sets image description which will be shown in zooming panel")]
        public string Description { get; set; }

        internal OboutInc.ImageZoom.DisplayStyle DisplayStyle
        {
            get
            {
                return OboutInc.ImageZoom.DisplayStyle.ListView;
            }
            set
            {
                this.ViewState["__displayStyle"] = value;
            }
        }

        [Bindable(true), Description(" Gets or sets the zoomin effect."), DefaultValue(1), Category("Settings")]
        public ImageZoomEffects Effect { get; set; }

        [Description("Enable/disable disk caching."), DefaultValue(false), Category("Settings")]
        public bool EnableCacheDirectory
        {
            get
            {
                object obj2 = this.ViewState["cachDir"];
                return ((obj2 != null) && Convert.ToBoolean(obj2));
            }
            set
            {
                this.ViewState["cachDir"] = value;
                ImageZoomEntry.EnableDiskCaching = value;
            }
        }

        [Browsable(false)]
        public override bool Enabled
        {
            get
            {
                return base.Enabled;
            }
            set
            {
                base.Enabled = value;
            }
        }

        [Browsable(false)]
        public override bool EnableTheming
        {
            get
            {
                return base.EnableTheming;
            }
            set
            {
                base.EnableTheming = value;
            }
        }

        [Browsable(false)]
        public override bool EnableViewState
        {
            get
            {
                return base.EnableViewState;
            }
            set
            {
                base.EnableViewState = value;
            }
        }

        internal StringBuilder EntryScripts { get; set; }

        private LinkButton FirstButton
        {
            get
            {
                return this._first;
            }
        }

        private bool HasParentControlCalledDataBinding
        {
            get
            {
                return (this._builder != null);
            }
        }

        [DefaultValue("ImageZoomHandler.ashx"), Bindable(true), Category("Settings"), Description("Name of ImageHandler if using custom HttpHandler.")]
        public string HttpHandlerName
        {
            get
            {
                object obj2 = this.ViewState["_HttpHandlerName"];
                if (obj2 == null)
                {
                    return base.ResolveUrl("ImageZoomHandler.ashx");
                }
                return base.ResolveUrl((string) obj2);
            }
            set
            {
                this.ViewState["_HttpHandlerName"] = value;
            }
        }

        [DefaultValue("50X50,100X100,150X150,200X200"), Description("The options for the ImageSize drop-down list."), Bindable(true), Category("Settings")]
        public string ImageSizeOptions
        {
            get
            {
                object obj2 = this.ViewState["ImageSizeOptions"];
                if (obj2 != null)
                {
                    return obj2.ToString();
                }
                return "50X50,100X100,150X150,200X200";
            }
            set
            {
                this.ViewState["ImageSizeOptions"] = value;
            }
        }

        private OboutDropDownList ImageSizeSelector
        {
            get
            {
                return this._imageSizeSelector;
            }
        }

        [Category("Appearance"), Description("Image in bynary format"), Bindable(true)]
        internal object ImageStream
        {
            get
            {
                return this._imageStream;
            }
            set
            {
                this._imageStream = value;
                if (this._imageStream != null)
                {
                    this.IsImageStream = false;
                }
                base.ChildControlsCreated = false;
            }
        }

        [Description("Get or Sets the ImageUrl."), Category("Appearance"), Editor(typeof(UrlEditor), typeof(UITypeEditor)), Bindable(true)]
        public string ImageUrl
        {
            get
            {
                return this._imageUrl;
            }
            set
            {
                string imagePath = value.Trim();
                while ((imagePath.Length > 0) && imagePath.EndsWith("/"))
                {
                    imagePath = imagePath.Substring(0, imagePath.Length - 1);
                }
                imagePath = this.resolveServerSide(imagePath);
                if (imagePath.StartsWith("http://") || imagePath.StartsWith("https://"))
                {
                    this.IsPathAbsolute = true;
                    this._imageUrl = imagePath;
                }
                else
                {
                    if (imagePath.IndexOf("~") == 0)
                    {
                        imagePath = base.ResolveUrl(imagePath);
                    }
                    this._imageUrl = imagePath;
                    if (!base.DesignMode)
                    {
                        try
                        {
                            FileInfo info = new FileInfo(this.Context.Server.MapPath(imagePath));
                            if (info.Attributes == FileAttributes.Directory)
                            {
                                this.MultiMode = true;
                            }
                            else
                            {
                                this.MultiMode = false;
                            }
                        }
                        catch (Exception exception1)
                        {
                            if (exception1 != null)
                            {
                            }
                            throw new Exception("Incorrect path in ImageUrl");
                        }
                    }
                }
                base.ChildControlsCreated = false;
            }
        }

        private List<string> InternalDataSource
        {
            get
            {
                if ((this.ViewState["_dataSource"] != null) && (this._dataSource.Count == 0))
                {
                    this._dataSource = this.ViewState["_dataSource"] as List<string>;
                }
                return this._dataSource;
            }
            set
            {
                this.ViewState["_dataSource"] = value;
            }
        }

        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
        internal bool IsCallback { get; set; }

        internal bool IsImageStream { get; set; }

        private bool IsNextVisible
        {
            get
            {
                return (this.CurrentPageIndex != this.TotalPagesToShow);
            }
        }

        internal bool IsPathAbsolute { get; set; }

        private bool IsPreviousVisible
        {
            get
            {
                return (this.CurrentPageIndex != 1);
            }
        }

        private LinkButton LastButton
        {
            get
            {
                return this._last;
            }
        }

        [TemplateContainer(typeof(LayoutContainer))]
        private ITemplate Layout
        {
            get
            {
                return (this._layout ?? new DefaultPagerLayout(this));
            }
            set
            {
                this._layout = value;
            }
        }

        [DefaultValue(false), Description("Specifies if the IZ is in multimode or in single mode")]
        internal bool MultiMode
        {
            get
            {
                if (this.ViewState["_MultiMode"] == null)
                {
                    this._multiMode = (this.ImageUrl == string.Empty) && !string.IsNullOrEmpty(this.DataUrlField);
                }
                else
                {
                    object obj2 = this.ViewState["_MultiMode"];
                    this._multiMode = (bool) obj2;
                }
                return this._multiMode;
            }
            set
            {
                ImageZoomEntry.MultiMode = value;
                this.ViewState["_MultiMode"] = value;
                if (this._imageUrl != string.Empty)
                {
                    this.InternalDataSource = this.GetFiles();
                }
            }
        }

        private LinkButton NextButton
        {
            get
            {
                return this._next;
            }
        }

        [DefaultValue("15"), Description(" Gets or sets number of frame render"), Category("Settings"), Bindable(true)]
        public int NumberOfFrames { get; set; }

        private int NumberOfPagersToGenerate
        {
            get
            {
                return (this.PagerSequence * this.NumberOfPagesShown);
            }
        }

        [DefaultValue(5), Category("Paging"), Description("Sets the number of pages displayed in the footer.")]
        public int NumberOfPagesShown
        {
            get
            {
                return this._results;
            }
            set
            {
                this._results = value;
            }
        }

        [Category("Client-Side Events"), Description("Client-side function which is executed when clicked on background."), Bindable(true)]
        public string OnBackgroundClick { get; set; }

        [Description("Client-side function which is executed before click on background processed."), Bindable(true), Category("Client-Side Events")]
        public string OnBeforeBackgroundClick { get; set; }

        [Category("Client-Side Events"), Bindable(true), Description("Client-side function which is executed before big image clicked.")]
        public string OnBeforeBigImageClick { get; set; }

        [Category("Client-Side Events"), Description("Client-side function which is executed before click on close button executed."), Bindable(true)]
        public string OnBeforeCloseButtonClick { get; set; }

        [Description("Client-side function which is executed before clicked on small image."), Bindable(true), Category("Client-Side Events")]
        public string OnBeforeImageClick { get; set; }

        [Bindable(true), Category("Client-Side Events"), Description("Client-side function which is executed before the ZoomIn start")]
        public string OnBeforeZoomIn { get; set; }

        [Description("Client-side function which is executed before ZoomOut start."), Bindable(true), Category("Client-Side Events")]
        public string OnBeforeZoomOut { get; set; }

        [Bindable(true), Category("Client-Side Events"), Description("Client-side function which is executed when clicked on big image.")]
        public string OnBigImageClick { get; set; }

        [Description("Client-side function which is executed when clicked on close button."), Bindable(true), Category("Client-Side Events")]
        public string OnCloseButtonClick { get; set; }

        [Bindable(true), Category("Client-Side Events"), Description("Client-side function which is executed when clicked on small image.")]
        public string OnImageClick { get; set; }

        [Description("Client-side function which is executed when big image is opened."), Bindable(true), Category("Client-Side Events")]
        public string OnZoomIn { get; set; }

        [Category("Client-Side Events"), Description("Client-side function which is executed when big image is closed."), Bindable(true)]
        public string OnZoomOut { get; set; }

        private Label PageNumberLabel
        {
            get
            {
                return this._pageNum;
            }
        }

        private Control PagerContainer { get; set; }

        private int PagerSequence
        {
            get
            {
                return Convert.ToInt32(Math.Ceiling((double) (((double) this.CurrentPageIndex) / ((double) this.NumberOfPagesShown))));
            }
        }

        [DefaultValue(5), Category("Paging"), Description("The number of images to be displayed on a page."), Bindable(true)]
        public int PageSize
        {
            get
            {
                int num = 5;
                object obj2 = this.ViewState["__pageSize"];
                if (obj2 != null)
                {
                    num = int.Parse(obj2.ToString());
                }
                if ((this.DisplayStyle != OboutInc.ImageZoom.DisplayStyle.ListView) && (this.DisplayStyle == OboutInc.ImageZoom.DisplayStyle.TableView))
                {
                    int num2 = this.Rows * this.Columns;
                    if (num > num2)
                    {
                        int num3 = num / this.Columns;
                        if ((num % this.Columns) > 0)
                        {
                            num3++;
                        }
                        this.Rows = num3;
                    }
                }
                this.ViewState["__pageSize"] = num;
                return num;
            }
            set
            {
                this.ViewState["__pageSize"] = value;
            }
        }

        [DefaultValue("5,10,15,20,30,40,50"), Category("Paging"), Description("The options for the PageSize drop-down list."), Bindable(true)]
        public string PageSizeOptions
        {
            get
            {
                object obj2 = this.ViewState["PageSizeOptions"];
                if (obj2 != null)
                {
                    return obj2.ToString();
                }
                return "5,10,15,20,30,40,50";
            }
            set
            {
                this.ViewState["PageSizeOptions"] = value;
            }
        }

        private OboutDropDownList PageSizeSelector
        {
            get
            {
                return this._pageSizeSelector;
            }
        }

        [DefaultValue(0), Bindable(true), Category("Layout"), Description(" Gets or sets position of zoom image.")]
        public ImageZoomPositions Position { get; set; }

        private LinkButton PreviousButton
        {
            get
            {
                return this._previous;
            }
        }

        [Bindable(true), DefaultValue(0), Category("Layout"), Description("Sets position of zoom image ralative to small one when Position property is set to \"RELATIVE\" ")]
        public int RelativeLeft { get; set; }

        [Category("Layout"), Bindable(true), DefaultValue(0), Description("Sets position of zoom image ralative to small one when Position property is set to \"RELATIVE\" ")]
        public int RelativeTop { get; set; }

        [Category("Settings"), Description("Describe the way by which image is served."), Bindable(true), DefaultValue(0)]
        public RenderingModes RenderingMode { get; set; }

        [Description("Number of rows per page in table layout."), Category("Layout"), Bindable(true), DefaultValue(4)]
        private int Rows
        {
            get
            {
                object obj2 = this.ViewState["PageRows"];
                if ((obj2 == null) && !this.AllowPaging)
                {
                    int count = this.InternalDataSource.Count;
                    int num2 = 0;
                    int num3 = (this.ViewState["PageColumns"] == null) ? 4 : this.Columns;
                    if (count > 0)
                    {
                        if (num3 == 0)
                        {
                            num3 = 1;
                        }
                        num2 = count / num3;
                    }
                    int num4 = count % num3;
                    if (num4 > 0)
                    {
                        num2++;
                    }
                    obj2 = num2;
                    this.ViewState["PageRows"] = (int) obj2;
                }
                if (obj2 != null)
                {
                    obj2 = (((int) obj2) == 0) ? 1 : obj2;
                }
                if (obj2 != null)
                {
                    return (int) obj2;
                }
                return 4;
            }
            set
            {
                this.ViewState["PageRows"] = value;
            }
        }

        [Bindable(true), Description("Property used for showing/hiding the footer of the ImageGallery."), Category("Layout"), DefaultValue(true)]
        public bool ShowFooter
        {
            get
            {
                object obj2 = this.ViewState["_ShowFooter"];
                if (obj2 != null)
                {
                    return (bool) obj2;
                }
                return true;
            }
            set
            {
                this.ViewState["_ShowFooter"] = value;
            }
        }

        [Category("Layout"), Bindable(true), Description("Property used for showing/hiding the footer of the ImageGallery."), DefaultValue(true)]
        public bool ShowHeader
        {
            get
            {
                object obj2 = this.ViewState["_ShowHeader"];
                if (obj2 != null)
                {
                    return (bool) obj2;
                }
                return true;
            }
            set
            {
                this.ViewState["_ShowHeader"] = value;
            }
        }

        [Description("Enables/disables the displaying of the loading message."), Category("Settings"), Bindable(true), DefaultValue(true)]
        public bool ShowLoading { get; set; }

        private bool ShowPager
        {
            get
            {
                return (this.TotalPagesToShow != 1);
            }
        }

        internal bool ShowWaterMark { get; set; }

        [Editor(typeof(UrlEditor), typeof(UITypeEditor)), Description("Gets or sets style folder for pagesize and image size selectors"), Bindable(true), Category("Appearance")]
        public string SizeSelectorStyle
        {
            get
            {
                if (this.ViewState["_dropStyleFolder"] == null)
                {
                    return string.Empty;
                }
                return (string) this.ViewState["_dropStyleFolder"];
            }
            set
            {
                this.ViewState["_dropStyleFolder"] = value;
            }
        }

        [Browsable(false)]
        public override string SkinID
        {
            get
            {
                return base.SkinID;
            }
            set
            {
                base.SkinID = value;
            }
        }

        private int StartRow
        {
            get
            {
                return ((this.PageSize * (this.CurrentPageIndex - 1)) + 1);
            }
        }

        [Bindable(true), Category("Appearance"), Editor(typeof(UrlEditor), typeof(UITypeEditor)), Description("Gets or sets style folder")]
        public string StyleFolder
        {
            get
            {
                if (this.ViewState["_StyleFolder"] != null)
                {
                    return (string) this.ViewState["_StyleFolder"];
                }
                return "";
            }
            set
            {
                string relativeUrl = (value != string.Empty) ? value.Trim() : string.Empty;
                if (relativeUrl.IndexOf("~") == 0)
                {
                    relativeUrl = base.ResolveUrl(relativeUrl);
                }
                this.ViewState["_StyleFolder"] = relativeUrl;
            }
        }

        protected override HtmlTextWriterTag TagKey
        {
            get
            {
                return HtmlTextWriterTag.Div;
            }
        }

        [Description("Whether the ytumbnail has a fixed size."), Category("Settings"), Bindable(true), DefaultValue(true)]
        public bool ThumbnailFixedSize { get; set; }

        [Description("Thumbnail height"), Category("Appearance"), DefaultValue(100), Bindable(true)]
        public int ThumbnailHeight
        {
            get
            {
                if (this.ViewState["Thumbnailwidth"] == null)
                {
                    return 100;
                }
                return Convert.ToInt32(this.ViewState["ThumbnailHeight"]);
            }
            set
            {
                this.ViewState["ThumbnailHeight"] = value;
            }
        }

        [Category("Appearance"), Bindable(true), DefaultValue(false), Description("Whether to show the image's description in the watermark of the thumbnail.")]
        public bool ThumbnailWatermark
        {
            get
            {
                return (bool)(this.ViewState["ThumbnailWatermark"] ?? false);
            }
            set
            {
                this.ViewState["ThumbnailWatermark"] = value;
            }
        }

        [Description("Color of the thumbnail's watermark."), Bindable(true), Category("Appearance"), DefaultValue(typeof(Color), "WhiteSmoke")]
        public Color ThumbnailWatermarkColor
        {
            get
            {
                return (Color)(this.ViewState["ThumbnailWatermarkColor"] ?? Color.WhiteSmoke);
            }
            set
            {
                this.ViewState["ThumbnailWatermarkColor"] = value;
            }
        }

        [Category("Appearance"), Bindable(true), Description("Font family of the thumbnail's watermark."), DefaultValue("verdana")]
        public string ThumbnailWatermarkFontFamily
        {
            get
            {
                return (this.ViewState["ThumbnailWatermarkFontFamily"].ToString() ?? "verdana");
            }
            set
            {
                this.ViewState["ThumbnailWatermarkFontFamily"] = value;
            }
        }

        [Bindable(true), Description("Font size of the thumbnail's watermark."), Category("Appearance"), DefaultValue(12)]
        public int ThumbnailWatermarkFontSize
        {
            get
            {
                return (Convert.ToInt32(this.ViewState["ThumbnailWatermarkFontSize"] ?? 12));
            }
            set
            {
                this.ViewState["ThumbnailWatermarkFontSize"] = value;
            }
        }

        [Category("Appearance"), Description("Font style of the thumbnail's watermark."), Bindable(true), DefaultValue(typeof(FontStyle), "Bold")]
        public FontStyle ThumbnailWatermarkFontStyle
        {
            get
            {
                return (FontStyle)(this.ViewState["ThumbnailWatermarkFontStyle"] ?? FontStyle.Bold);
            }
            set
            {
                this.ViewState["ThumbnailWatermarkFontStyle"] = value;
            }
        }

        [Category("Appearance"), Bindable(true), DefaultValue(100), Description("Thumbnail width")]
        public int ThumbnailWidth
        {
            get
            {
                if (this.ViewState["Thumbnailwidth"] == null)
                {
                    return 100;
                }
                return Convert.ToInt32(this.ViewState["Thumbnailwidth"]);
            }
            set
            {
                this.ViewState["Thumbnailwidth"] = value;
            }
        }

        [Browsable(false)]
        public override string ToolTip
        {
            get
            {
                return base.ToolTip;
            }
            set
            {
                base.ToolTip = value;
            }
        }

        private int TotalPage
        {
            get
            {
                if (this._builder == null)
                {
                    this.GetBuilder();
                }
                return this._builder.Adapter.TotalCount;
            }
        }

        internal int TotalPagesToShow
        {
            get
            {
                return Convert.ToInt32(Math.Ceiling((double) (((double) this.TotalPage) / ((double) this.PageSize))));
            }
        }

        [Browsable(false)]
        public override bool Visible
        {
            get
            {
                return base.Visible;
            }
            set
            {
                base.Visible = value;
            }
        }

        [DefaultValue(""), Description("Watermark text shown on big image"), Bindable(true), Category("Appearance")]
        public string WatermarkText
        {
            get
            {
                object obj2 = this.ViewState["_WaterMarkText"];
                if (obj2 == null)
                {
                    return "";
                }
                return obj2.ToString();
            }
            set
            {
                if (!string.IsNullOrEmpty(value))
                {
                    this.ShowWaterMark = true;
                }
                this.ViewState["_WaterMarkText"] = value;
            }
        }

        [Bindable(true), Category("Settings"), Description("Sets the z-index css property for the Big Image."), DefaultValue("1000")]
        public int zIndex { get; set; }

        [Category("Settings"), Bindable(true), DefaultValue("200"), Description(" Gets or sets zooming time")]
        public int ZoomTime { get; set; }
    }
}

